
#import "UIImage+ImageDownLoader.h"

@implementation UIImage (ImageDownLoader)


//图片解析
+(void)imageDownLoaderWithPicUrlStr:(NSString *)picUrlStr ImageBlock:(ImageBlock)ib
{
      //解析
    NSURL *url = [NSURL URLWithString:picUrlStr];
    
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
   
    [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
        
        //转成图片
        UIImage *i = [UIImage imageWithData:data];
        
        //3.调用block
        //把图片作为参数传过去
        ib(i);
        
    }];
}

@end
